import request from '@/utils/request'

// 获取奖品列表
export const getItemList = () => {
  return request({
    url: '/item',
    method: 'get'
  })
}

// 获取奖品图片URL
export const getItemPhotoUrl = (itemId: string) => {
  return request({
    url: `/getphotourl/${itemId}`,
    method: 'get'
  })
}

// 添加奖品
export const addItem = (data: FormData) => {
  return request({
    url: '/item',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 修改奖品
export const updateItem = (data: FormData) => {
  return request({
    url: '/item',
    method: 'put',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 删除奖品
export const deleteItem = (itemId: string) => {
  return request({
    url: `/item/${itemId}`,
    method: 'delete'
  })
} 